using System.Collections.Generic;
using System.Data.SqlClient;

namespace DatabaseUnitTesting.Utilities.StoredProcedure
{
    internal static class SqlExecuter
    {
        internal static void ExecuteScript(SqlConnection connection, List<string> commands,
                                           string targetDatabase)
        {
            if(commands == null)
                return;
            DatabaseAdapter databaseAdapter = new DatabaseAdapter(connection);
            databaseAdapter.UseDatabase(targetDatabase);
            foreach(string command in commands)
                new SqlCommand(command, connection).ExecuteNonQuery();
        }
    }
}